[PATCH] ws: get a new mask for each new outgoing frame
authorDaniel Stenberg <daniel@haxx.se>
Mon, 8 Sep 2025 12:14:15 +0000 (14:14 +0200)
committerSamuel Henrique <samueloph@debian.org>
Fri, 8 May 2026 14:16:21 +0000 (07:16 -0700)
commit93d469145452d334e108da2494545898d20811f8
tree0c912516524c59b2ba1a754afeb420cd0d8a1dc0
parent171c1557353b94f65fa29b25062c9eaba4948936
[PATCH] ws: get a new mask for each new outgoing frame

Reported-by: Calvin Ruocco
Closes #18496

Backported-by: Samuel Henrique <samueloph@debian.org>
Backported-by: Alex <alex@puer-robustus.eu>
Changes:
* Refresh patch context for lib/ws.c
* Adapt return value to current function return type

Backported by: Samuel Henrique <samueloph@debian.org>

Changes:
* Apply the per-frame mask generation in ws_packethead() (bookworm
  7.88.1) rather than upstream's ws_enc_add_frame() (and trixie's
  ws_enc_write_head()), since the bookworm code path that builds the
  outgoing frame header is structurally different. On Curl_rand()
  failure return 0 -- ws_packethead() already uses 0 as the
  soft-error sentinel for buffer-too-small.
* Preserve the DEBUGBUILD CURL_WS_FORCE_ZERO_MASK escape hatch
  alongside the new per-frame mask generation, matching upstream.
* Remove the corresponding one-time mask generation in
  Curl_ws_accept(), and initialise `result` to CURLE_OK at
  declaration since it is no longer unconditionally assigned by the
  removed Curl_rand() call.

Gbp-Pq: Name CVE-2025-10148.patch
lib/ws.c